// 配置文件
import React from 'react'
import { lazy } from 'react';
import { Route,Routes } from 'react-router-dom'
const Order = lazy(() => import('../pages/Order'));
const Find = lazy(() => import('../pages/Find'));
const Mine = lazy(() => import('../pages/Mine'));
const Home = lazy(() => import('../pages/Home'));
const Cities = lazy(() => import('../pages/Cities'));
const HomeDetail = lazy(() => import('../pages/HomeDetail'));
const HomeOrder = lazy(() => import('../pages/HomeDetail//HomeOrder'));
const HomeComment = lazy(() => import('../pages/HomeDetail/HomeComment'));
const HomeBusiness = lazy(() => import('../pages/HomeDetail/HomeBusiness'));
// 推迟加载 运行 按需加载 当切换到这个路由后 加载

export default function RoutesConfig() {
  return (
    <div>
        <Routes>
            <Route path='/' element={<Home />}></Route>
            <Route path='/home' element={<Home />}></Route>
            <Route path='/find' element={<Find />}></Route>
            <Route path='/order' element={<Order />}></Route>
            <Route path='/mine' element={<Mine />}></Route>
            <Route path="/cities" element={<Cities />}></Route>
            <Route path="/homedetail/:id" element={<HomeDetail />}>
                <Route path='/homedetail/:id/order' element={<HomeOrder/>}></Route>
                <Route path='/homedetail/:id/comment' element={<HomeComment/>}></Route>
                <Route path='/homedetail/:id/business' element={<HomeBusiness/>}></Route>
            </Route>
        </Routes>
    </div>
  )
}
